#ifndef LINK_PUB_H
#define LINK_PUB_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// 学生结构体
typedef struct Student {
    char student_id[20];
    char name[50];
    char selected_courses[100][20];  // 已选课程列表
    int course_count;
    int total_credits;
    struct Student* next;
} Student;

// 课程结构体
typedef struct Course {
    char course_id[20];
    char course_name[100];
    char course_type[20];
    int teaching_hours;
    int credits;
    int enrolled_count;
    int max_capacity;
    char enrolled_students[1000][20];
    struct Course* next;
} Course;

// 通用链表操作函数声明
Student* add_student(Student* head, Student* new_student);
Student* delete_student(Student* head, Course* course_head, const char* student_id);
Student* find_student(Student* head, const char* student_id);
Course* add_course(Course* head, Course* new_course);
Course* delete_course(Course* head, Student* student_head, const char* course_id);
Course* find_course(Course* head, const char* course_id);
void log_operation(const char* operation, const char* details);

#endif